package com.hnas.eCard.domain;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.alibaba.fastjson.JSONObject;
import com.hnas.common.util.PostConnServerUtils;
import com.hnas.core.util.SpringContextUtil;

public class SendSMSThread implements Runnable {
	
	private static Log log = LogFactory.getLog(SendSMSThread.class);
	
	private Object sendData;
	
	private PostConnServerUtils postConnServerUtils;
	
	public SendSMSThread(Object sendData){
		this.sendData = sendData;
	}
	
	@Override
	public void run() {
//		PostConnServer postConnServer = new PostConnServer();
		log.info("###开始发送短信消息提醒###");
		this.postConnServerUtils = (PostConnServerUtils) SpringContextUtil.getBean("postConnServerUtils");
		try {
			JSONObject sendSMSRes = postConnServerUtils.sendSMS(sendData);
			if(!sendSMSRes.getBoolean("result")) {
				log.info("发送短信消息提醒失败");
			}
			log.info("###结束发送短信消息提醒###");
		} catch (Exception e) {
			e.printStackTrace();
			log.error("发送短信消息提醒异常");
		}
	}
}
